% Area Sources

I = eye (3109,3109);
%% NOx NO3
NOx_county_storage_A = zeros(3109, 3109);

run Area_Reset
NOx_Area_Source = 28761.72.*1.35.*(NOx_Cal.*Area_Source {1,1});
p = 1;
for n = 1:S;
    sprintf('Area Sources: %d/%d, Loop: %d of 25.', n, S, p)
    Emission_Plus = (Area_Source {4,1}(:,2)'+I (n,:));
    NOx (:,1) = ((Emission_Plus)*(NOx_Area_Source))';

    run Nitrate_Sulfate_Ammonium_Marginal_New
    run PM_25_Health

        Damages = [All_Mort{Cause,1}];
        NOx_A(n,1) = ((sum(sum(Damages)))) - B_25_Primary_MD;

        NOx_county_storage_A(n,:) = all_mort_damages_county' - all_mort_dam_cnty_base';
        clear all_mort_damages_county

    clear Damages
end
 clear NOx_Area_Source

 
%% Primary PM 25 
PM_county_storage_A = zeros(3109, 3109);

run Area_Reset
p = 2;
PM_Area_Source = 28761.72.*(PM25_Cal.*Area_Source {2,1});
for n = 1:S;   
    sprintf('Area Sources: %d/%d, Loop: %d of 25.', n, S, p)
    Emission_Plus = (Area_Source {4,1}(:,4)'+I (n,:));
    PM_25_Primary (:,1) = ((Emission_Plus)*(PM_Area_Source))';                         
       
    run Nitrate_Sulfate_Ammonium_Marginal_New
    run PM_25_Health
    

    Damages = [All_Mort{1,1}];
    PM_25_A(n,1) = ((sum(sum(Damages)))) - B_25_Primary_MD;
    
    PM_county_storage_A(n,:) = all_mort_damages_county' - all_mort_dam_cnty_base';
    clear all_mort_damages_county

clear Damages
end
clear PM_Area_Source


%% SO2 SO4
SO2_county_storage_A = zeros(3109, 3109);

run Area_Reset
p = 3;
SO2_Area_Source = 28761.72.*1.5.*(SO2_Cal.*Area_Source {3,1});
for n = 1:S;
    sprintf('Area Sources: %d/%d, Loop: %d of 25.', n, S, p)
    Emission_Plus = (Area_Source {4,1}(:,5)'+I (n,:));
    SO2 (:,1) = ((Emission_Plus)*(SO2_Area_Source))';
    
    run Nitrate_Sulfate_Ammonium_Marginal_New
    run PM_25_Health


        Damages = [All_Mort{Cause,1}];
        SO2_A(n,1) = ((sum(sum(Damages)))) - B_25_Primary_MD;
        
        SO2_county_storage_A(n,:) = all_mort_damages_county' - all_mort_dam_cnty_base';
        clear all_mort_damages_county

    clear Damages
end
clear SO2_Area_Source
%% NH3 NH4
NH3_county_storage_A = zeros(3109, 3109);

run Area_Reset
p = 4;
NH3_Area_Source = 28761.72.*1.06.*(NH4_Cal.*Area_Source {5,1});
for n = 1:S;
    sprintf('Area Sources: %d/%d, Loop: %d of 25.', n, S, p)
    Emission_Plus = (Area_Source {4,1}(:,1)'+I (n,:));
    NH3 (:,1) = ((Emission_Plus)*(NH3_Area_Source))';    

    run Nitrate_Sulfate_Ammonium_Marginal_New     
    run PM_25_Health

        Damages = [All_Mort{Cause,1}];
        NH3_A(n,1) = ((sum(sum(Damages)))) - B_25_Primary_MD;
        
        NH3_county_storage_A(n,:) = all_mort_damages_county' - all_mort_dam_cnty_base';
        clear all_mort_damages_county

    clear Damages
end
clear NH3_Area_Source
%% VOC
VOC_county_storage_A = zeros(3109, 3109);

run Area_Reset

p = 5;
for n = 1:S;
    sprintf('Area Sources: %d/%d, Loop: %d of 25.', n, S, p)
    Emission_Plus = (Area_Source {4,1}(:,6)'+I (n,:));
    A_VOC (:,1) = (28761.72.*(Emission_Plus)*(VOC_Cal.*Area_Source {2,1}))';    

    run Nitrate_Sulfate_Ammonium_Marginal_New      
    run PM_25_Health

        Damages = [All_Mort{Cause,1}];
        VOC_A(n,1) = ((sum(sum(Damages)))) - B_25_Primary_MD;
        
        VOC_county_storage_A(n,:) = all_mort_damages_county' - all_mort_dam_cnty_base';
        clear all_mort_damages_county

        clear Damages
end

